package model;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class AdminImpl implements Admin {

	private Connection conn;

	public AdminImpl(Connection conn) throws SQLException, IOException {
		this.conn = conn;
	}

	public String getPassword(int idAdmin) throws SQLException,NullPointerException {
		String query = "SELECT password FROM Admin WHERE idAdmin = ?";
		PreparedStatement stat = conn.prepareStatement(query);
		stat.setInt(1, idAdmin);
		ResultSet rs = stat.executeQuery();
		rs.next();
		return rs.getString("password");
	}

}
